<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <title><spring:message code="message.list.PeiSongZhongDingDan"/></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
</head>

<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">

    <section class="content-header">
        <h1><spring:message code="message.list.WuLiuXinXiGengXin"/></h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.list.ShangPinPeiSong"/></a></li>
            <li class="active"><a href="#"><spring:message code="message.list.WuLiuXinXiGengXin"/></a></li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <form id="form">
                <div class="input" style="margin-top:-5px;">
                	<div class="textalign1"><spring:message code="message.lable.yiLiaoJiGouMingCheng"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="hospName" name="hospName" placeholder="<spring:message code="message.lable.yiLiaoJiGouMingCheng"/>" />
                    </div>
                	<div class="textalign"><spring:message code="message.listForm.DingDanBaoHao"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="orderPackId" name="orderPackId" placeholder="<spring:message code="message.listForm.DingDanBaoHao"/>" />
                    </div>
                    <div class="textalign"><spring:message code="message.listForm.YiLiaoJiGouDiQu"/><spring:message code="message.yanZheng.maoHao"/></div>
                    <div class="boxinput">
                       <table style="width:100%;">
                           <tr>
                              <td style="width:33%">
                                <select class="textinput" id="area1" name="area1" disabled="disabled">
                                	<option value="${area.areaId}">${area.areaName}</option>
                                </select>
                              </td>
                              <td style="width:33%">   
                                <select class="textinput" id="area2" name="area2" ></select>
                                </td>
                              <td style="width:33%">
                                <select class="textinput" id="areaId" name="areaId" ></select>
                              </td>
                           </tr> 
                        </table>     
                    </div>
                </div>
               <div class="input" style="margin-top:-5px">
               		<div class="textalign1"><spring:message code="message.listForm.CaiGouRiQi"/><spring:message code="message.yanZheng.maoHao"/></div>
	                <div class="boxinput"> 
                       <table style="width:100%">
                                <tr>
                                    <td style="width:50%">
                                        <input id="startDatestr" name="startDatestr" type="text" class="textinput" placeholder="yyyy-MM-dd11" 
											data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'endDatestr\')}'})" />
                                    </td>
                                    <td>&nbsp;-&nbsp;</td>
                                    <td style="width:50%">
                                        <input id="endDatestr" name="endDatestr" type="text" class="textinput"  placeholder="yyyy-MM-dd" 
                                        data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'startDatestr\')}'})" /> 
                                    </td> 
                                </tr>
                            </table>
                    </div>
                    <div class="textalign"><spring:message code="message.listForm.QueRenRiQi"/><spring:message code="message.yanZheng.maoHao"/></div>
	                <div class="boxinput"> 
                       <table style="width:100%">
                                <tr>
                                    <td style="width:50%">
                                        <input id="confirmStartDate" name="confirmStartDate" type="text" class="textinput" placeholder="yyyy-MM-dd11" 
											data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'confirmEndDate\')}'})" />
                                    </td>
                                    <td>&nbsp;-&nbsp;</td>
                                    <td style="width:50%">
                                        <input id="confirmEndDate" name="confirmEndDate" type="text" class="textinput"  placeholder="yyyy-MM-dd" 
                                        data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'confirmStartDate\')}'})" /> 
                                    </td> 
                                </tr>
                            </table>
                    </div>
                    <div class="textalign"><spring:message code="message.listForm.PeiSongRiQi"/><spring:message code="message.yanZheng.maoHao"/></div>
	                <div class="boxinput"> 
                       <table style="width:100%">
                                <tr>
                                    <td style="width:50%">
                                        <input id="psStartDate" name="psStartDate" type="text" class="textinput" placeholder="yyyy-MM-dd11" 
											data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'psEndDate\')}'})" />
                                    </td>
                                    <td>&nbsp;-&nbsp;</td>
                                    <td style="width:50%">
                                        <input id="psEndDate" name="psEndDate" type="text" class="textinput"  placeholder="yyyy-MM-dd" 
                                        data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'psStartDate\')}'})" /> 
                                    </td> 
                                </tr>
                            </table>
                    </div>
               </div>
               <div class="input" style="margin-top:-5px">
               		<div class="textalign1"><spring:message code="message.listForm.ChuKuRiQi"/><spring:message code="message.yanZheng.maoHao"/></div>
	                <div class="boxinput"> 
                       <table style="width:100%">
                                <tr>
                                    <td style="width:50%">
                                        <input id="delStartDate" name="delStartDate" type="text" class="textinput" placeholder="yyyy-MM-dd11" 
											data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'delEndDate\')}'})" />
                                    </td>
                                    <td>&nbsp;-&nbsp;</td>
                                    <td style="width:50%">
                                        <input id="delEndDate" name="delEndDate" type="text" class="textinput"  placeholder="yyyy-MM-dd" 
                                        data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'delStartDate\')}'})" /> 
                                    </td> 
                                </tr>
                            </table>
                    </div>
                    <div class="textalign"><spring:message code="message.listForm.SongDaRiQi"/><spring:message code="message.yanZheng.maoHao"/></div>
	                <div class="boxinput"> 
                       <table style="width:100%">
                                <tr>
                                    <td style="width:50%">
                                        <input id="recpStartDate" name="recpStartDate" type="text" class="textinput" placeholder="yyyy-MM-dd11" 
											data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'recpEndDate\')}'})" />
                                    </td>
                                    <td>&nbsp;-&nbsp;</td>
                                    <td style="width:50%">
                                        <input id="recpEndDate" name="recpEndDate" type="text" class="textinput"  placeholder="yyyy-MM-dd" 
                                        data-date-fmt="yyyy-MM-dd" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'recpStartDate\')}'})" /> 
                                    </td> 
                                </tr>
                            </table>
                    </div>
                 
                
                    <div class="textalign1" >  
                    <button type="button" class="btn btn-success btn-sm" onclick="search()" id="selectDicCompType"><spring:message code="message.button.seachSpacing"/></button>
                    </div>
                </div>
                    </form>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
             
    </section>
    
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
  //绑定回车
    $('#orderPackId,#hospName,#area1,#area2,#areaId,#startDatestr,#endDatestr,#confirmStartDate,#confirmEndDate,#psStartDate,#psEndDate,#delStartDate,#delEndDate,#recpStartDate,#recpEndDate').bind('keydown', function(event) {
        if (event.keyCode == "13") {
            $('#selectDicCompType').click();
        }
    });	
    $("#hospName").focus();//加载页面光标在第一个查询框内
    
    
        function showFocus(rowId) {
            $("#gridlist").resetSelection();
            $("#gridlist").setSelection(rowId);
        }
    	
        $(function () {
        	var jsonData = formatForm("form");
            $("#gridlist").jqGrid({
                url: "getOrderAlready.html",
                mtype: "POST",
                datatype: "json",
                postData:jsonData,
                autowidth: true,
                shrinkToFit: false,
                height: 290,
                colNames: [
                           '<spring:message code="message.jqGrid.cz"/>',
                           '<spring:message code="message.listForm.DingDanBaoHao"/>',
                           '<spring:message code="message.lable.yiLiaoJiGouMingCheng"/>',
                           '<spring:message code="message.listForm.YiLiaoJiGouDiQu"/>',
                           '<spring:message code="message.listForm.CaiGouShiJian"/>',
                           '<spring:message code="message.listForm.ZongJinE"/>',
                           '<spring:message code="message.listForm.QueRenShiJian"/>',
                           '<spring:message code="message.listForm.QueRenRen"/>',
                           '<spring:message code="message.listForm.PeiSongShiJian"/>',
                           '<spring:message code="message.listForm.ChuKuShiJian"/>',
                           '<spring:message code="message.listForm.DaoDaShiJian"/>',
                           '<spring:message code="message.listForm.YiPeiSongTiaoMuShu"/>',
                           '<spring:message code="message.listForm.WeiPeiSongTiaoMuShu"/>',
                           '<spring:message code="message.listForm.WuFaPeiSongTiaoMuShu"/>'
                          
                           ],
                colModel: [
					{ name: 'operate', width: 90, align:"center", sortable: false,
					    formatter : function(val, opts, rowdata) {
					    	var str = "";
					    	if(rowdata.ypsCount != 0 ){
					    		if(rowdata.recpDatetime){
					    		str = "<a href=\"javascript:$.HN.dialog.opendialog('"+rowdata.orderPackId+"','"+rowdata.orderPackId+"','${ctx}/purOrderInfo/toOrderLogistics.html?orderPackId="+rowdata.orderPackId  + "','850px','400px',function operResult(val){return operResult;})\"><spring:message code="message.listForm.ChaKanWuLiuXinXi"/></a>";
					    		}else{
					    			str =  "<a href='javascript:updateLogistics(\""+rowdata.orderPackId+"\");'><spring:message code="message.listForm.GengXinWuLiuXinXi"/></a>";
					    		}
					    		 
					    	}
					        return str;
					}
					},
                    { name: 'orderPackId', width: 210 , align:"center" ,sortable: false,
                        formatter:function(cellvalue, options, row){
                            return '<a href="javascript:showOrderPackId(\''+ row.orderPackId +'\');">'+cellvalue+'</a>';
                        }
                    },
                    { name: 'hospName', width: 160 , align:"center" ,sortable: false,
                        formatter:function(cellvalue, options, row){
                            return '<a href="javascript:showHospInfo(\''+ row.hospId +'\');">'+cellvalue+'</a>';
                        }
                    },
                    { name: 'areaName', width: 120 , align:"center" ,sortable: false},
                    { name: 'submitDateTime', width: 140 , align:"center" ,sortable: false},
                    { name: 'orderMoney', width: 80 , align:"right",sortable: false},
                    { name: 'orderConfirmTime', width: 140 , align:"center" ,sortable: false},
                    { name: 'username', width: 200 , align:"left" ,sortable: false},
                    { name: 'psDatetime', width: 140 , align:"center" ,sortable: false},
                    { name: 'delDatetime', width: 140 , align:"center" ,sortable: false},
                    { name: 'recpDatetime', width:140 , align:"center" ,sortable: false},
                    { name: 'ypsCount', width: 80 , align:"center",sortable: false,
                        formatter : function(val, opts, rowdata) {
                        	var str = "";
                        	if(rowdata.ypsCount != 0){
                        		 str = "<a href='toYpsOrderDetail.html?orderPackId="+rowdata.orderPackId+"'>"+val+"</a>";
                        	}else{
                        		str = rowdata.ypsCount;
                        	}
                            return str;
                            }
                    },
                    { name: 'wpsCount', width: 80 , align:"center",sortable: false,
                        formatter : function(val, opts, rowdata) {
                        	var str = "";
                            if(rowdata.wpsCount != 0){
                                 str = "<a href='toWpsOrderDetail.html?orderPackId="+rowdata.orderPackId+"'>"+val+"</a>";
                            }else{
                                str = rowdata.wpsCount;
                            }
                            return str;
                            }
                    },
                    { name: 'wfpsCount', width: 100 , align:"center",sortable: false,
                        formatter : function(val, opts, rowdata) {
                        	var str = "";
                            if(rowdata.wfpsCount != 0){
                                 str = "<a href='toWfpsOrderDetail.html?orderPackId="+rowdata.orderPackId+"'>"+val+"</a>";
                            }else{
                                str = rowdata.wfpsCount;
                            }
                            return str;
                            }
                    }
                    
                ],
                
                rowNum: 20,
                rowList: [10, 20,50,100],
                rownumbers: true,
                multiselect: false,
                pager: "#gridpage",
                viewrecords: true,
                gridComplete:function(){
                	//序号列宽度自适应（参数为jqgridID）
                    autoRNWidth("gridlist");
                	//数据只有一条时默认选中（参数为jqgridID）
                    selectByOneData("gridlist");
                },
                caption: "<spring:message code="message.list.YiPeiSongDingDanLieBiao"/>",
                jsonReader: {
                    repeatitems: false,
                    id: "orderPackId"
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
            
            
           
             
             
             
             /* 医疗机构所属地区 */
             $("#area2").HNSelect({
                 parent_selector: "#area1",  url: "${pageContext.request.contextPath}/selectController/getArea.html", dataid: "ID",defaultText: "<option value=''><spring:message code="message.select.option"/></option>",
                 func: function () {
                     $("#areaId").HNSelect({
                         parent_selector: "#area2", url: "${pageContext.request.contextPath}/selectController/getArea.html", dataid: "ID", defaultText: "<option value=''><spring:message code="message.select.option"/></option>",
                     });
                 }
             });
            
            
        });
        
        
        /* 查询 */
        function search(page) {
        	var jsonData = formatForm("form");
            
            var areaId = $.trim($("#areaId").val());
            if(areaId == null || areaId==""){
                jsonData['areaId']=$.trim($("#area2").val());
            }
           
            $("#gridlist").jqGrid("clearGridData");
                $("#gridlist").jqGrid('setGridParam',{  
                mtype: "POST",
                datatype:'json',
                postData:jsonData,
                page : (page || 1)
            }).trigger("reloadGrid"); //重新载入  
        }
        
   
        //医疗机构信息弹窗
        function showHospInfo(hospId) {
            $.HN.dialog.open({
                "id": "showHospInfo", 
                "title": "<spring:message code="message.listForm.yiLiaoJiGouxinxi"/>", 
                "url": "${ctx}/stdHospInfo/hospInfoDetail.html?hospId="+hospId,
                "data": {}, 
                "width": 800, 
                "height": 400, 
                "closefunc":function() {
                    
                }
            });
        }
        
        //物流信息
        function updateLogistics(orderPackId){
            
            $.HN.dialog.open({
            id:"Logistics",
            title:"<spring:message code="message.listForm.GengXinWuLiuXinXi"/>",
            url:"${ctx}/purOrderLogistics/toUpdateLogistics.html?interflowId="+orderPackId,
            data:{"interflowId":orderPackId},
            width:"800px",
            height:"400px"
            });
        }
        
        
        //订单包号、订单明细编号 链接 订单追踪页面
        function showOrderPackId(orderPackId) {
           $.HN.dialog.open({
               "id": "showOrderPackId", 
               "title": "<spring:message code="message.list.DingDanWuLiuXinXi"/>", 
               "url": "${ctx}/purOrderInfo/toOrderLogistics.html?orderPackId="+orderPackId,
               "data": {}, 
               "width": 850, 
               "height": 400, 
               "closefunc":function() {
                   
               }
           });
       } 
        
    </script>
</body>
</html>